package com.ruoyi.quartz.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quartz.mapper.YongyouCgddMapper;
import com.ruoyi.quartz.domain.YongyouCgdd;
import com.ruoyi.quartz.service.IYongyouCgddService;

/**
 * 采购订单Service业务层处理
 * 
 * @author SYF
 * @date 2025-04-17
 */
@Service
public class YongyouCgddServiceImpl implements IYongyouCgddService 
{
    @Autowired
    private YongyouCgddMapper yongyouCgddMapper;

    /**
     * 查询采购订单
     * 
     * @param vouchdate 采购订单主键
     * @return 采购订单
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public YongyouCgdd selectYongyouCgddByVouchdate(String vouchdate)
    {
        return yongyouCgddMapper.selectYongyouCgddByVouchdate(vouchdate);
    }

    /**
     * 查询采购订单列表
     * 
     * @param yongyouCgdd 采购订单
     * @return 采购订单
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public List<YongyouCgdd> selectYongyouCgddList(YongyouCgdd yongyouCgdd)
    {
        return yongyouCgddMapper.selectYongyouCgddList(yongyouCgdd);
    }

    /**
     * 新增采购订单
     * 
     * @param yongyouCgdd 采购订单
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int insertYongyouCgdd(YongyouCgdd yongyouCgdd)
    {
        return yongyouCgddMapper.insertYongyouCgdd(yongyouCgdd);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgddByDate(String date)
    {
        return yongyouCgddMapper.deleteYongyouCgddByDate(date);
    }

    /**
     * 修改采购订单
     * 
     * @param yongyouCgdd 采购订单
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int updateYongyouCgdd(YongyouCgdd yongyouCgdd)
    {
        return yongyouCgddMapper.updateYongyouCgdd(yongyouCgdd);
    }

    /**
     * 批量删除采购订单
     * 
     * @param vouchdates 需要删除的采购订单主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgddByVouchdates(String[] vouchdates)
    {
        return yongyouCgddMapper.deleteYongyouCgddByVouchdates(vouchdates);
    }

    /**
     * 删除采购订单信息
     * 
     * @param vouchdate 采购订单主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgddByVouchdate(String vouchdate)
    {
        return yongyouCgddMapper.deleteYongyouCgddByVouchdate(vouchdate);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public int clearCgdd(){
        return yongyouCgddMapper.clearCgdd();
    }
}
